package org.springcloud.wisdom.springcloud_03_freshman.student.service;

import org.springcloud.wisdom.springcloud_03_freshman.student.dao.PaidDao;
import org.springcloud.wisdom.springcloud_03_freshman.student.entity.Paid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PaidService {
    @Autowired
    PaidDao paidDao;

    /**
     * 更新付款时间以及付款状态 订单号
     * @param paid 缴费实体类
     * @return
     */
    public boolean update(Paid paid){
        if (paid==null){
            return false;
        }
        return paidDao.updatePaidBySno(paid)>0;
    }

    /**
     * 根据sno查缴费记录
     * @param sno 学号
     * @return
     */
    public List<Paid> getPaids(String sno){
        if (sno==null){
            return null;
        }
        return paidDao.getPaids(sno);
    }
    /**
     * 根据sno查缴费记录
     * @param sno 学号
     * @return
     */
    public Paid getPaid(String sno){
        if (sno==null){
            return null;
        }
        return paidDao.getPaidBySno(sno);
    }
}
